//
//  DXBaseTableViewController.swift
//  weiBoOfSwift
//
//  Created by simon on 15/12/5.
//  Copyright © 2015年 simon. All rights reserved.
//

import UIKit
import SVProgressHUD

class DXBaseTableViewController: UITableViewController,DXVisitViewDelegate {
//    子类可以继承,对外界的接口判断是否登录
    var isLogin:Bool = DXUserAccountViewModel.shareUserAccount.isLogIn
//    子类可以继承,对外界的接口,访客视图子类可以拿到
    var visitView:DXVisitView?

    override func loadView() {
        
        isLogin ? super.loadView() : setUpVisitView()
        
    
   }
    
    // MARK: - 设置访客视图
    private func setUpVisitView(){
        
        visitView = DXVisitView(frame: UIScreen.mainScreen().bounds)
//        设置代理
        visitView?.delegate = self
        view = visitView
//        设置navigationItem
        navigationItem.leftBarButtonItem = UIBarButtonItem.customItem(title: "注册", target: self, action: "visitViewRegisterBtnSelected")
         navigationItem.rightBarButtonItem = UIBarButtonItem.customItem(title: "登录", target: self, action: "visitViewLoginBtnSelected")
        
    }
    
    // MARK: - DXVisitViewDelegate 登录
    func visitViewLoginBtnSelected() {
        logPrint("visitViewLoginBtnSelected")
        
        
        let LogInController = DLogInViewController()
    presentViewController(DXNavigationController(rootViewController:LogInController), animated: true, completion: nil)
        
        
    }
    
    func visitViewRegisterBtnSelected() {
        logPrint("visitViewRegisterBtnSelected")
    }
    
//    // MARK: - 注册按钮点击事件
//    @objc private func registerBtnClick(){
//        
//    }
//    // MARK: - 登录按钮点击事件
//    @objc private func LoginBtnClick(){
//        
//    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

         }

 

}
